using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 攻击策略工厂
/// </summary>
public static class AttackStrategyFactory
{
    public static IAttackStrategy Create(AttackType type, SkillData data)
    {
        switch (type)
        {
            case AttackType.SingleShot:
                // 如果是机枪射手，使用专门的攻击策略
                if (data is GatlingSkillData)
                {
                    return new GatlingAttackStrategy(data);
                }
                // 如果是双发射手，使用专门的攻击策略
                if (data is RepeaterSkillData)
                {
                    return new RepeaterAttackStrategy(data);
                }
                return new SingleShotStrategy(data);

            case AttackType.SpreadShot:
                return new SpreadStrategy(data);

            case AttackType.Ice:
                // 如果是雪花豌豆，使用专门的攻击策略
                if (data is SnowPeaSkillData)
                {
                    return new SnowPeaAttackStrategy(data);
                }
                return new IceStrategy(data);
            
            case AttackType.Produce:
                return new ProduceStrategy(data);
            
            case AttackType.Taunt:
                return new TauntStrategy(data);
            
            case AttackType.Explosive:
                // 如果是火爆辣椒，使用专门的攻击策略
                if (data is JalapenoSkillData)
                {
                    return new JalapenoAttackStrategy(data);
                }
                return new DefaultAttack(data);
            
            case AttackType.Squash:
                // 如果是窝瓜，使用专门的攻击策略
                if (data is SquashSkillData)
                {
                    return new SquashAttackStrategy(data);
                }
                return new DefaultAttack(data);
            
            case AttackType.Jalapeno:
                // 火爆辣椒攻击策略
                if (data is JalapenoSkillData)
                {
                    return new JalapenoAttackStrategy(data);
                }
                return new DefaultAttack(data);
            
            case AttackType.PotatoMine:
                // 土豆地雷攻击策略
                if (data is PotatoMineSkillData)
                {
                    return new PotatoMineAttackStrategy(data);
                }
                return new DefaultAttack(data);
        }

        return new DefaultAttack(data);
    }
}
